package com.bhdx.blog.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

/**
 * @author bhdx
 * @date 2020/6/16-11:52
 *
 */
public class ResponseUtil {
    /**
     * 向response对象写入对象
     * @param response
     * @param obj
     * @throws Exception
     */
    public static  void write(HttpServletResponse response,Object obj) throws  Exception{
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out=response.getWriter();
        out.println(obj.toString());
        out.flush();
        out.close();
    }
}
